#!/bin/bash
model=none
datasets=none
val_datasets=none
test_datasets=none
gpus=0
iou_cover_threshold=0.5
proposals_cover_threshold=0.7
gt_boxes_cover_threshold=0.7


get_opts()
{
    echo "======================================"
    while [ -n "$1" ]
    do
        case "$1" in
            --model)
                echo ">> model : $2"
                model=$2
                shift
                ;;
            --datasets)
                echo ">> datasets : $2"
                datasets=$2
                shift
                ;;
            --val-datasets)
                echo ">> val datasets : $2"
                val_datasets=$2
                shift
                ;;
            --test-datasets)
                echo ">> test datasets : $2"
                test_datasets=$2
                shift
                ;;
            --gpus)
                echo ">> gpus : $2"
                gpus=$2
                shift
                ;;
            --iou-cover-threshold)
                echo ">> iou-cover-threshold : $2"
                iou_cover_threshold=$2
                shift
                ;;
            --proposals-cover-threshold)
                echo ">> proposals-cover-threshold : $2"
                proposals_cover_threshold=$2
                shift
                ;;
            --gt-boxes-cover-threshold)
                echo ">> gt-boxes-cover-threshold : $2"
                gt_boxes_cover_threshold=$2
                shift
                ;;
            --)
                break
                shift
                ;;
            *)
                echo "== unknown option : $1"
                ;;
        esac
        shift
    done
    echo "======================================"
}

get_opts $*

python predict_net.py --model $model --datasets $datasets --val-datasets $val_datasets --test-datasets $test_datasets --gpus $gpus \
&& python evaluate_net_grid.py --model $model --datasets $datasets --val-datasets $val_datasets --test-datasets $test_datasets --iou-cover-threshold $iou_cover_threshold --proposals-cover-threshold $proposals_cover_threshold --gt-boxes-cover-threshold $gt_boxes_cover_threshold \
&& python analysis_net_grid.py --model $model --datasets $datasets --val-datasets $val_datasets --test-datasets $test_datasets --iou-cover-threshold $iou_cover_threshold --proposals-cover-threshold $proposals_cover_threshold --gt-boxes-cover-threshold $gt_boxes_cover_threshold
